package com.fengke.dao.model;

import org.apache.commons.lang3.builder.ToStringBuilder;

public class TagModel extends BaseEntity {
	private static final long serialVersionUID = 1314241325188289110L;
	/**
	 * 类型
	 */
	public enum Type {
		/** 商品标签 */
		product(0),
		/** 用户 */
		member(1);
		private int type;
		Type(int type) {
			this.type = type;
		}
		public int getType() {
			return this.type;
		}
	}
	public enum DisplayInfo {
		imageHead(0),
		descInfo(1);
		private int displayInfo;
		DisplayInfo(int displayInfo) {
			this.displayInfo = displayInfo;
		}
		public int getDisplayInfo() {
			return this.displayInfo;
		}
	}
	/** 名称 */
	private String name;
	/** 类型 */
	private Type type;
	private Integer mtype;
	/** 图标 */
	private String icon;
	/** 备注 */
	private String memo;
	private DisplayInfo displayInfo;
	private Integer mdisplayInfo;
	
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Type getType() {
		return type;
	}
	public void setType(Type type) {
		this.type = type;
	}
	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	}
	public String getMemo() {
		return memo;
	}
	public void setMemo(String memo) {
		this.memo = memo;
	}
	public Integer getMtype() {
		if(this.type == null) {
			return null;
		}
		this.mtype = this.type.getType();
		return mtype;
	}
	public void setMtype(Integer mtype) {
		this.mtype = mtype;
		if(mtype == null) {
			return ;
		}
		if(mtype == Type.product.getType()) {
			this.type = Type.product;
		} else if(mtype == Type.member.getType()) {
			this.type = Type.member;
		}
	}
	public DisplayInfo getDisplayInfo() {
		return displayInfo;
	}
	public void setDisplayInfo(DisplayInfo displayInfo) {
		this.displayInfo = displayInfo;
	}
	public Integer getMdisplayInfo() {
		if(this.displayInfo == null) {
			return null;
		}
		this.mdisplayInfo = this.displayInfo.getDisplayInfo();
		return mdisplayInfo;
	}
	public void setMdisplayInfo(Integer mdisplayInfo) {
		this.mdisplayInfo = mdisplayInfo;
		if(mdisplayInfo == null) {
			return ;
		}
		if(mdisplayInfo == DisplayInfo.imageHead.getDisplayInfo()) {
			this.displayInfo = DisplayInfo.imageHead;
		} else if(mdisplayInfo == DisplayInfo.descInfo.getDisplayInfo()) {
			this.displayInfo = DisplayInfo.descInfo;
		}
	}
}
